<style scoped>
  .weui-form-preview__hd label, .weui-form-preview__hd em {
    font-size: .9em !important;
  }
  .weui-loadmore_line .weui-loadmore__tips {
    background-color: #eee;
  }
  .weui-cells {
    margin-top: 0;
  }
  .weui-cells_form {
    background: #fbfbfb;
  }
  .weui-cell {
    background: #fff;
  }
  .weui-cells__title {
    text-align: left;
  }
  .oitem {
    padding: 3px;
  }
  .hide {
    display: none;
  }
  #acts {
    font-size: 0;
  }
  #acts span {
    font-size: 14px;
  }
  .halfbtn {
    display: inline-block;
    width: 49%;
  }
  .weui-label {
    text-align: left;
  }
  .weui_cell {
    padding: 10px 15px;
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
    background: #fff;
  }
  .weui-cell_select {
    padding: 0 15px;
  }


  .weui-panel {
    background: #eee;
  }

  .rj-cont-tit {
    margin: 0;
    border-radius: 0;
  }

  .weui-panel {
    margin-top: 0;
    text-align: left;
  }

  .hd .weui-grid.js_grid {
    font-weight: 600;
  }

  .weui-grid.js_grid {
    width: 25%;
    padding: 10px 1px;
  }

  /*.weui-grid.fir {*/
  /*  width: 20%;*/
  /*}*/
  /*.weui-grid.sec {*/
  /*  width: 15%;*/
  /*}*/
  /*.weui-grid.thr {*/
  /*  width: 20%;*/
  /*}*/
  /*.weui-grid.fou {*/
  /*  width: 15%;*/
  /*}*/
  /*.weui-grid.fiv {*/
  /*  width: 15%;*/
  /*}*/
  .weui-grid__label {
    text-overflow: initial;
  }
  .section {
    margin: 5px;
    border-radius: 5px;
  }


  .weui_uploader_input_wrp {
    float: left;
    position: relative;
    margin-right: 9px;
    margin-bottom: 9px;
    width: 77px;
    height: 77px;
    border: 1px solid #D9D9D9;
  }

  .weui_uploader_hd {
    padding-top: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .weui_uploader_files {
    list-style: none;
  }

  .weui_uploader_input_wrp:before {
    width: 2px;
    height: 39.5px;
  }

  .weui_uploader_input_wrp:before, .weui_uploader_input_wrp:after {
    content: " ";
    position: absolute;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    background-color: #D9D9D9;
  }

  .weui_uploader_input {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  }

  .weui_uploader_input_wrp:after {
    width: 39.5px;
    height: 2px;
  }

  .weui_uploader_bd {
    overflow: hidden;
  }

  .weui_cell {
    padding: 10px 15px;
    position: relative;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
  }

  .outstore >>> .weui-uploader_files {
    list-style: none;
    overflow-y: hidden;
  }

  .outstore >>> .weui-uploader_file {
    float: left;
    margin-right: 9px;
    margin-bottom: 9px;
    width: 79px;
    background: no-repeat 50%;
    background-size: cover;
  }

  .weui-cell.fir {
    border-top: 0;
  }

  .help {
    text-align: right;
    padding: 5px;
    font-size: 12px;
    color: #bbb;
  }

  .weui_uploader_input_wrp.inrow {
    width: 30px;
    height: 30px;
    margin: 0;
  }

  .weui_uploader_input_wrp:before {
    height: 19.5px;
  }

  .weui_uploader_input_wrp:after {
    width: 19.5px;
  }

  .weui-uploader_file.inrow {
    margin: 0;
    width: 40px;
  }

  li.weui-uploader_file {
    display: inline-block;
    padding: 3px 5px;
  }

  ul#images {
    text-align: right;
  }
  .weui-panel__bd {
    width: auto !important;
    padding: 10px 15px;
    text-align: left;
  }
  .rj-cell {
    font-size: 0.9em;
    display: inline-block;
    margin-right: 15px;
  }

  .weui-navbar a {
    text-decoration: none;
    color: #333;
  }

  .weui_tab_bd_item {
    display: none;
    height: 100%;
    overflow: auto;
  }
  .weui_tab_bd_item.weui_tab_bd_item_active {
    display: block;
  }
</style>
<template>
  <div class="examine" style="background: #eee; padding-bottom: 70px;">
    <div class="rj-wrap" style="background: #fff;">
      {{title}}
      <a href="javascript:;" @click="$router.back(-1)" style="position: absolute; left: 10px; top: 8px">
        <img src="@/assets/back.png" style="width: 20px" />
      </a>
    </div>
    <div class="weui-tab">
      <div class="weui-navbar">
        <a class="weui-navbar__item" href="#tab1">订单信息</a>
        <a class="weui-navbar__item weui-bar__item_on" href="#tab2">派车信息</a>
      </div>
      <div class="weui-tab__panel" style="">
        <div id="tab1" class="weui_tab_bd_item">
          <div class="weui-form-preview section" style="background: #fff;">
            <div class="weui-form-preview__hd">
              <label class="weui-form-preview__label">编号</label>
              <em class="weui-form-preview__value">{{baseInfo.sellcode}}</em>
            </div>
            <div class="weui-form-preview__bd">
              <div class="weui-form-preview__item">
                <label class="weui-form-preview__label">申请人</label>
                <span class="weui-form-preview__value">{{baseInfo.applyname}}</span>
              </div>
            </div>
          </div>
          <div class="weui-form-preview section" style="background: #fff;">
            <div class="cellgroup">
              <div class="weui-cell fir">
                <div class="weui-cell__hd">
                  <label class="weui-label">发货联系人</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" id="delicontact" name="delicontact" v-model="wlinfo.delicontact"
                         placeholder=" 请输入发货联系人"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">联系电话</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="number" id="delicontacttel" name="delicontacttel"
                         v-model="wlinfo.delicontacttel" placeholder=" 请输入发货人手机号"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label id='unqualifiedchkrateDiv' class="weui-label">发货地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" id='deliprovince' name="deliprovince"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">详细地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" id='deliaddress' name="deliaddress"
                         v-model="wlinfo.deliaddress" placeholder=" 请输入发货详细地址"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">收货联系人</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" id="arricontact" name="arricontact" v-model="wlinfo.arricontact"
                         placeholder="请输入收货联系人"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">联系电话</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="number" id="arricontactno" name="arricontactno"
                         v-model="wlinfo.arricontactno" placeholder=" 请输入收货人手机号"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">收货地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" id='arriprovince' name="arriprovince"></div>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__hd">
                  <label class="weui-label">详细地址</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" id='arriaddres' name="arriaddres"
                         v-model="wlinfo.arriaddres" placeholder=" 请输入收货详细地址"></div>
              </div>
            </div>
          </div>
        </div>
        <div id="tab2" class="weui_tab_bd_item weui_tab_bd_item_active">
          <div class="weui-form-preview section" style="background: #fff;">
            <div class="weui-cells weui-cells_form">
              <div class="weui-cell fir" style="position: relative;">
                <div class="weui-cell__hd">
                  <label class="weui-label">运输方式</label></div>
                <div class="weui-cell__bd">
                  <select class="weui-select" name="transtype" v-model="wlinfo.transtype">
                    <option value="1">派车</option>
                    <option value="3">快递</option>
                  </select>
                </div>
              </div>
              <div class="weui-cell" style="position: relative;">
                <div class="weui-cell__hd">
                  <label class="weui-label">物流公司</label></div>
                <div class="weui-cell__bd">
                  <select class="weui-select" v-model="wlcompany" @change="takeWlcompany" >
                    <option value="">请选择</option>
                    <option v-for="(item) in wlcompanys" :value="item">{{item.name}}</option>
                  </select>
                </div>
              </div>
              <div class="weui-cell" v-if="wlinfo.transtype == 3">
                <div class="weui-cell__hd">
                  <label class="weui-label">快递单号</label></div>
                <div class="weui-cell__bd">
                  <input class="weui-input" type="text" required name="kdcode" v-model="wlinfo.kdcode" placeholder="请输入快递单号">
                </div>
              </div>
              <template v-if="wlinfo.transtype == 1">
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">司机电话</label></div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="number" id="driverphone" @blur="getWLDriver()"
                           name="driverphone" v-model="wlinfo.driverphone" placeholder="请输入司机联系电话"></div>
                </div>
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">司机姓名</label></div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="text" required id="drivername" name="drivername"
                           v-model="wlinfo.drivername" placeholder="请输入司机姓名"></div>
                </div>
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">车型</label></div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="text" name="cartype" v-model="wlinfo.cartype"
                           placeholder="请输入车型"></div>
                </div>
                <div class="weui-cell">
                  <div class="weui-cell__hd">
                    <label class="weui-label">车牌号</label></div>
                  <div class="weui-cell__bd">
                    <input class="weui-input" type="text" name="carcode" v-model="carcode"
                           id="carcode" placeholder="请输入车牌号" @change="editCarcode">
                  </div>
                </div>
              </template>

              <div v-if="wlinfo.existOrderCode" style="background: #fff;text-align: right">
                <label for="weuiAgree" class="weui-agree" style="padding-top: 0;">
                  <input id="weuiAgree" type="checkbox" checked name="pingche" v-model="wlinfo.pingche" value="1" @change="takePinche" class="weui-agree__checkbox">
                  <span class="weui-agree__text">
                      是否和物流订单 {{wlinfo.existOrderCode}} 拼车？
                    </span>
                </label>
              </div>
              <template v-if="wlinfo.transtype == 1">
                <div class="weui-cells weui-cells_form">
                  <div class="weui-cell">
                    <div class="weui-cell__hd">
                      <label class="weui-label">结算方式</label>
                    </div>
                    <div class="weui-cell__bd">
<!--                      <input class="weui-input" id="faretypeC" name="faretypeC" placeholder="运费结算方式">-->
                      <select class="weui-select" name="faretypeC" v-model="wlinfo.faretype">
                        <option value="">请选择结算方式</option>
                        <option v-for="(item) in faretypes" :value="item.dictValue">{{item.dictLabel}}</option>
                      </select>
                    </div>
                  </div>
                </div>
                <div class="weui-cells weui-cells_form">
                  <div class="weui-cell">
                    <div class="weui-cell__hd">
                      <label class="weui-label">运价</label></div>
                    <div class="weui-cell__bd">
                      <input class="weui-input" type="number" id="fareprice" name="fareprice" v-model="wlinfo.fareprice" placeholder="运价" style="width: 45%;">
<!--                      <input class="weui-select" type="text" id="farePriceTypeC" name="farePriceTypeC" placeholder="运价方式" style="width: 51%; padding-left: 0;">-->
                      <select class="weui-select" name="farepricetype" v-model="wlinfo.farepricetype"  style="width: 51%; padding-left: 0;color:#000;">
                        <option value="">请选择计价方式</option>
                        <option v-for="(item) in farepricetypes" :value="item.dictValue">{{packfpType(item.dictValue)}}</option>
                      </select>
                    </div>
                  </div>
                </div>
                <div class="weui-cell">
                  <div class="weui-cell__bd">
                    <textarea class="weui-textarea opinion" id="opinion" name="opinion" v-model="wlinfo.remark" placeholder="请输入备注内容"
                              rows="2"></textarea>
                  </div>
                </div>
              </template>
            </div>
          </div>
          <!--    动态数据-->
          <p style="height: 5px;"></p>
          <div class="weui-cells weui-cells_form section">
            <form action="" method="post" id="formid">
              <div class="weui-cell fir">
                <div class="weui-cell__hd"><label class="weui-label">附件上传</label></div>
                <div class="weui-cell__ft">
                  <div class="weui_uploader_bd">
                    <ul class="weui_uploader_files"></ul>
                    <div class="weui_uploader_input_wrp inrow">
                      <UploadFile3 class="weui_uploader_input" v-on:pushfile="setFile"></UploadFile3>
                    </div>
                  </div>
                </div>
                <ul class="weui-uploader_files" id="images">
                  <li class="weui-uploader_file" v-for="(fil, index) in filenames" @click=delFile(fil,fileids[index])>
                    {{fil}}
                  </li>
                </ul>
              </div>
              <div class="weui-cell">
                <div class="weui-cell__bd">
                  <textarea class="weui-textarea opinion" v-model="opinion" name="opinion" placeholder="请输入意见内容" rows="2"></textarea>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>

    <div id="bmlogs">
      <SalesOperationLogs7 :nodeid="nodeid" :orderid="id" :srguid="baseInfo.srguid" :departid="baseInfo.departid" :flowid="flowid"></SalesOperationLogs7>
    </div>
      <ApproveBom v-if="isReady" type="sellSendcar" :flowid="flowid" :nodeid="nodeid" :id="id" :srguid="baseInfo.srguid" :departid="baseInfo.departid" :model="wlinfo" :opinion="opinion" :fileids="fileids" :refuseflag="refuseflag" :annex="annex" passUrl="/prod-api/bill/sellform/sendCar" refuseUrl="/prod-api/bill/sellform/refuse" :navgateUrl="`/sellform2/SellformList?flowid=${flowid}`" ></ApproveBom>
  </div>
</template>

<script>
  import wx from 'weixin-js-sdk';
  import SalesOperationLogs7 from '@/components/common/SalesOperationLogs7'
  import ApproveBom from '@/components/common/ApproveBom'
  import UploadFile3 from "../common/UploadFile3";

  export default {
  name: 'SendCar34',
  data () {
    return {
      flowid: 34,
      opinion: '',
      openid: localStorage.openid,
      id: '',
      title: '',
      nodeid: '',
      annex: '',
      baseInfo: {},
      baseItems: '',
      wxParams: {},
      images: {
        serverId: [],
        srcStr: [],
      },
      refuseflag: '',
      refuseNodes: [],
      orderfiles: [],
      isReady: false,
      filenames: [],
      fileids: [],
      qaform:{},
      qaFormImg:[],
      titleName:"",
      whoutform:[],
      whinform:[],
      wlinfo: {
        type: 2,
        transtype: 1,
        pingche: false,
        existOrderCode: '',
        existOrderId: '',
        farepricetype: '',
        faretype: ''
      }, //物流信息
      wlcompanys: [],
      wlcompany: '',
      faretypes: [],
      faretype: '',
      farepricetypes: [],
      farepricetype: '',
      carcode: '',
    }
  },
    components: {
      SalesOperationLogs7,
      ApproveBom,
      UploadFile3
    },
    computed: {
      deliaddrs: function () {
        return this.wlinfo.deliprovince + " " + this.wlinfo.delicity + " " + this.wlinfo.delidistrict;
      },
      arriaddrs: function () {
        return this.wlinfo.arriprovince + " " + this.wlinfo.arricity + " " + this.wlinfo.arridistrict;
      },
      pageTitle: function () {
        let tit = '销售订单';
        switch (this.flowid) {
          case '34':
            tit = '电商订单';
            break;
          case '35':
            tit = '样品订单';
            break;
          default:
            tit = '销售订单';
            break;
        }
        return tit;
      }
    },
    created() {
      if (this.$route.query.flowid) this.flowid = this.$route.query.flowid;
      //页面title设置
      document.title = '土豆集-' + this.pageTitle;
    },
  mounted () {
    // this.existOrderCode = 'TF220512';
    // this.existOrderId = 'f67add1528de4485b967e869fd0229aa';
    //tab页切换
    $('.weui-navbar__item').on('click', function () {
      $(this).addClass('weui-bar__item_on').siblings('.weui-bar__item_on').removeClass('weui-bar__item_on');
      //内容切换
      $(".weui-tab__panel .weui_tab_bd_item_active").removeClass('weui_tab_bd_item_active');
      var data_toggle = jQuery(this).attr("href");
      $(data_toggle).addClass("weui_tab_bd_item_active");
    });

    //$('#opinion').focus();
    this.id = this.$route.query.id;
    this.nodeid = this.$route.query.nodeid;
    this.annex = this.$route.query.annex;
    this.title = this.$route.query.title;
    this.refuseflag = this.$route.query.refuseflag;

    this.getBaseInfo(this.id);
    this.getFarePriceTypes();
    this.getFareTypes();
    this.getWlcompanys();

    if (this.$route.query.status) {
      this.status = this.$route.query.status;
    }
    let that = this;

    // $('#faretypeC').select({
    //   title: "运费结算方式",
    //   items: [{"title": "公司结算", "value": 1}, {"title": "客户结算", "value": 2}],
    //   onChange: function (data) {
    //     that.wlinfo.faretype = data.values;
    //     $('input[name="wlcompanyguid"]').val($('#wlcompany').data('values'));
    //     $('#faretype').val(data.values);
    //   }
    // });
    $("#deliprovince").cityPicker({
      title: "请选择发货地址",
    });
    $("#arriprovince").cityPicker({
      title: "请选择收货地址"
    });
  },
  methods: {
    takeWlcompany(val) {
      this.wlinfo.customername = this.wlcompany.name;
      this.wlinfo.customerid = this.wlcompany.id;
    },
    packfpType: function(type) {
      return type == 1 ? '元/车' : '元/吨';
    },
    //获取物流公司
    getWlcompanys() {
      let that = this;
      this.axios({
        method: 'get',
        url: '/prod-api/organization/supplier/getWlComp',
        params: {},
      }).then(function (response) {
        if (response.data.code == 200) {
          that.wlcompanys = response.data.data;
          // var datalist = new Array;
          // $.each(data, function (index, itsm) {
          //   var info = {"title": itsm.name, "value": itsm.id};
          //   datalist.push(info);
          // });
          // $('#customername').select({
          //   title: "物流公司",
          //   items: datalist,
          //   onChange: function (data) {
          //     $('input[name="faretype"]').val($('#wlcompany').data('values'));
          //     // $('#customername').val(data.titles);
          //     // $('#customerid').val(data.values);
          //     that.wlinfo.customerid = data.values;
          //     that.wlinfo.customername = data.titles;
          //   }
          // });
        } else {
          that.toastError('获取物流公司失败!');
        }
      });
    },
    takePinche(val) {
      console.log('val:', val)
      console.log('this.wlinfo.pingche:', this.wlinfo.pingche)
    },
    getFarePriceTypes: function() {
      let that = this;
      this.axios({
        method: 'get',
        url: '/prod-api/system/dict/data/type/fare_price_type',
      }).then(response => {
        if (response.data.code == 200) {
          this.farepricetypes = response.data.data;
          // var data = response.data.data;
          // var datalist = new Array;
          // $.each(data, function (index, itsm) {
          //   var info = {"title": itsm.dictLabel, "value": itsm.dictValue};
          //   datalist.push(info);
          //   if ($('#farepricetype').val() == itsm.dictValue) {
          //     $('#farePriceTypeC').val(itsm.dictLabel);
          //   }
          // });
          // $('#farePriceTypeC').select({
          //   title: "运价方式",
          //   items: datalist,
          //   onChange: function (data) {
          //     $('#farepricetype').val(data.values);
          //     that.wlinfo.farepricetype = data.values;
          //     // console.log(data)
          //     //$('input[name="farepricetype"]').val($('#farePriceTypeC').data('values'));
          //   }
          // });
        } else {
          this.toastText('获取运价方式数据失败');
        }
      });
    },
    getFareTypes: function() {
      let that = this;
      this.axios({
        method: 'get',
        url: '/prod-api/system/dict/data/type/wlinfo_fare_type',
      }).then(response => {
        if (response.data.code == 200) {
          this.faretypes = response.data.data;
        } else {
          this.toastText('获取运价方式数据失败');
        }
      });
    },
    editCarcode: function(e) {
      console.log('editCarcode: ', e.target.value)
      this.checkCarcode(e.target.value);
      this.wlinfo.carcode = e.target.value;
    },
    checkCarcode: function (val) {
      let that = this;
      this.axios({
        method: 'get',
        url: '/prod-api/wlinfo/wlinfo/checkWlInfo',
        params: {carCode: val, orderid: that.baseInfo.guid},
      }).then(function(response) {
          console.log(response.data.code == 200 && response.data.data)
          if (response.data.code == 200 && response.data.data && response.data.data.orderCode) {
            console.log(response.data.data.orderCode)
            console.log(response.data.data.guid)
            console.log('that.wlinfo:', that.wlinfo)
            console.log('that.wlinfo.existOrderId:', that.wlinfo.existOrderId)
            that.wlinfo.pingche = true;
            that.wlinfo.existOrderCode = response.data.data.orderCode;
            that.wlinfo.existOrderId = response.data.data.guid;
            that.$forceUpdate();
          } else {
            that.wlinfo.pingche = false;
            that.wlinfo.existOrderCode = '';
            that.wlinfo.existOrderId = '';
          }
      });
    },
    serialize2Obj: function (data) {
      var obj = {};
      $.each(data, function (i, v) {
        obj[v.name] = v.value;
      })
      return obj;
    },
    getWLDriver: function () {
      let that = this;
      this.axios({
        method: 'get',
        responseType: 'json',
        headers: {"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"},
        url: '/prod-api/wlinfo/wlinfo/getWlDriver',
        params: {mobilephone: $('#driverphone').val()}
      }).then(response => {
        if (response.data.code == 200) {
          var info = response.data.data;
          //赋值司机信息
          let driveInfo = info.driveInfo;
          that.wlinfo.drivername = driveInfo.drivername
          that.wlinfo.driverphone = driveInfo.driverphone
          that.wlinfo.carcode = driveInfo.code;
          $("#drivername").val(driveInfo.drivername);
          $("#carcode").val(driveInfo.code);
          that.carcode = driveInfo.code;
          if (that.carcode) {
            that.checkCarcode(that.carcode);
          }
        }
        if (response.data.msg == 'error') {
          that.toastError('系统异常!');
        }
        if (response.data.msg == 'wlError') {
          that.toastError('物流平台系统异常!');
        }
      });
    },
    loadCarCode: function (carCode) {
      if (carCode == '' || carCode == undefined) {
        return;
      }
      $('#cn0').text(carCode.substring(0, 1));
      $('#cn1').text(carCode.substring(1, 2));
      $('#cn2').text(carCode.substring(2, 3));
      $('#cn3').text(carCode.substring(3, 4));
      $('#cn4').text(carCode.substring(4, 5));
      $('#cn5').text(carCode.substring(5, 6));
      $('#cn6').text(carCode.substring(6, 7));
      console.log(2)

    },
    delFile: function (name, id) {
      let that = this;
      $.confirm('确定要删除？', function () {
        that.axios({
          method: 'post',
          url: '/prod-api/common/delete',
          params: {id: id}
        })
        that.fileids = that.fileids.filter(item => {
          return item != id;
        })
        that.filenames = that.filenames.filter(item => {
          return item != name;
        })
      })
    },
    setFile: function (file) {
      this.filenames.push(file.name);
      this.fileids.push(file.id);
    },
    //获取回显数据
    getBaseInfo: function (id) {
      let that = this;
      this.axios({
        method: 'get',
        url: '/prod-api/wlinfo/wlinfo/toSendCar',
        params: {orderid:id, orderType:2},
      }).then(function (response) {
        if (response.data.code == 200) {
          that.isReady = true;
          that.baseInfo = response.data.order;
          if (response.data.wlinfos.length > 0) {
            that.wlinfo = response.data.wlinfos[0];
            setTimeout(() => {
              if (that.wlinfo.customername && that.wlcompanys && that.wlcompanys.length > 0) {
                that.wlcompany = that.wlcompanys.find(item => item.id == that.wlinfo.customerid);
              }
            }, 100)
            that.carcode = that.wlinfo.carcode;
            if (that.carcode) {
              that.checkCarcode(that.carcode);
            }
            that.loadCarCode(that.wlinfo.carcode);
            $('#deliprovince').val(that.checkObjNull(that.wlinfo.deliprovince) + " " + that.checkObjNull(that.wlinfo.delicity) + " " + that.checkObjNull(that.wlinfo.delidistrict));
            $('#arriprovince').val(that.checkObjNull(that.wlinfo.arriprovince) + " " + that.checkObjNull(that.wlinfo.arricity) + " " + that.checkObjNull(that.wlinfo.arridistrict));
          } else {
            that.wlinfo.delicontact = that.baseInfo.deliContact;
            that.wlinfo.delicontacttel = that.baseInfo.deliContactNo;
            that.wlinfo.deliprovince = that.baseInfo.deliProvince;
            that.wlinfo.delicity = that.baseInfo.deliCity;
            that.wlinfo.delidistrict = that.baseInfo.deliDistrict;
            that.wlinfo.deliaddress = that.baseInfo.deliAddress;
            that.wlinfo.arriprovince = that.baseInfo.arriProvince;
            that.wlinfo.arricity = that.baseInfo.arriCity;
            that.wlinfo.arridistrict = that.baseInfo.arriDistrict;
            that.wlinfo.arricontact = that.baseInfo.arriContact;
            that.wlinfo.arricontactno = that.baseInfo.arriContactNo;
            that.wlinfo.arriaddres = that.baseInfo.arriAddress;
            $('#deliprovince').val(that.checkObjNull(that.baseInfo.deliProvince) + " " + that.checkObjNull(that.baseInfo.deliCity) + " " + that.checkObjNull(that.baseInfo.deliDistrict));
            $('#arriprovince').val(that.checkObjNull(that.baseInfo.arriProvince) + " " + that.checkObjNull(that.baseInfo.arriCity) + " " + that.checkObjNull(that.baseInfo.arriDistrict));
            console.log('that.wlinfo：', that.wlinfo)
            that.$forceUpdate();
          }
        }
      });
    },


}
}
</script>
